{% extends 'base.html' %}
{% block css %}
<link href="/static/css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="/static/css/bootstrap-switch.min.css" rel="stylesheet">
<link href="/static/layui/css/layui.css" rel="stylesheet">
<link href="//at.alicdn.com/t/font_1371028_imgl1ee9c7.css" rel="stylesheet">


{% endblock %}
{% block content %}
<div class="right_col" role="main">
    <div class="">
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <div class="loading"></div>
                        <h2>redis值set </h2>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content" style="padding-top:10px;border:none">
                        <div class="row" style="margin-left: 5px;">
                            <div class="form-inline">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">类型</label>
                                        <div class="layui-input-block" style="padding-top: 9px">
                                          <input type="radio" name="type" value="0" checked/>string
                                          <input type="radio" name="type" value="1"/>hash<br>
                                        </div>
                                    </div>
                                    <div>
                                        <label class="layui-form-label">key值</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="key" lay-verify="required" placeholder="请输入key值" class="layui-input">
                                          </div>
                                    </div>

                                    <div style="padding-left: 30px;padding-top: 10px;padding-bottom: 10px">
                                        <button type="submit" class="layui-btn" lay-submit="立即提交"onclick="sucess_redis()" >查询</button>
                                    </div>


                                    <div style="margin-bottom:10px;">
                                        <div class="col-sm-12">
                                            <table class="table table-hover table-bordered table-striped" style="table-layout: fixed;word-wrap:break-word" overflow="hidden"  >
                                              <thead>
                                                <tr style="background-color: #f5f5f5;">
                                                  <th>结果</th>
                                                  <th>操作</th>
                                                </tr>
                                              </thead>
                                              <tbody id="audit_table">
                                                <tr name="tbody">
                                                  <td id="result_show"></td>
                                                    <td><button class="iconfont icon-Trashbin" data-toggle="modal" data-target="#myModal" ></button></td>
                                                </tr>
                                              </tbody>
                                            </table>
                                        </div>
                                    </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×
				</button>
				<h4 class="modal-title" id="myModalLabel">
					提示
				</h4>
			</div>
			<div class="modal-body">
				确认是否清除缓存key值!
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default"
						data-dismiss="modal">关闭
				</button>
				<button type="button" class="btn btn-primary" onclick="del_redis_key()">
					确定
				</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

{% endblock %}

{% block js %}

<script type="text/javascript">

    function sucess_redis() {
        var redis_type = $('input[type=radio][name=type]:checked').val()
        var redis_key = $('input[type=text]').val()
        params = {
               "redis_type":redis_type,
               "redis_key":redis_key,
           }
        $.ajax({

            type: 'POST',
            url: '/op/redis_manger',
            data: params,
            success: function (res) {
                 $("#result_show").html(res);
            }
        });
    }


    function del_redis_key() {

        var redis_key2 = $('input[type=text]').val()
        var redis_type2 = $('input[type=radio][name=type]:checked').val()
        params2 = {
               "redis_type2":redis_type2,
               "redis_key2":redis_key2,
           }
        $.ajax({
            type: 'POST',
            url: '/op/redis_del',
            data: params2,
            success: function (res) {
                if(res==1){
                    window.location.href="/op/redis_manger"
                }
                else {
                    alert("删除bad");
                }

            }
        });

    }


</script>



<script src="/static/js/jquery.dataTables.min.js"></script>
<script src="/static/js/dataTables.bootstrap.min.js"></script>
<script src="/static/js/display_select.js"></script>
<script src="/static/js/bootstrap-switch.min.js"></script>
<script src="/static/layui/layui.js"></script>


{% endblock %}

